package com.ardf.entity;

import com.ardf.common.LocalDateTimeToStringSerializer;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 打卡详情表
 * </p>
 *
 * @author ShiYunHao
 * @since 2025-01-06
 */
@Getter
@Setter
public class Details implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 打卡id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 指卡号
     */
    //@TableField(value = "card_number")
    private String cardNumber;

    /**
     * 打卡顺序
     */
    @TableField("`order`")
    private Integer order;

    /**
     * 站号
     */
    private Integer stationNumber;

    /**
     * 打卡时间
     */
    @JsonSerialize(using = LocalDateTimeToStringSerializer.class)
    private LocalDateTime clockTime;

    /**
     * 外键：成绩id
     */
    private Long gradeId;

    public Details(Long id, String cardNumber, Integer order, Integer stationNumber, LocalDateTime clockTime, Long gradeId) {

        this.id = id;
        this.cardNumber = cardNumber;
        this.order = order;
        this.stationNumber = stationNumber;
        this.clockTime = clockTime;
        this.gradeId = gradeId;
    }

    public Details(String cardNumber, Integer order, Integer stationNumber, LocalDateTime clockTime, Long gradeId) {

        this.cardNumber = cardNumber;
        this.order = order;
        this.stationNumber = stationNumber;
        this.clockTime = clockTime;
        this.gradeId = gradeId;
    }

    @Override
    public String toString() {
        return "Details{" +
                "id=" + id +
                ", cardNumber='" + cardNumber + '\'' +
                ", order=" + order +
                ", stationNumber=" + stationNumber +
                ", clockTime=" + clockTime +
                ", gradeId=" + gradeId +
                '}';
    }
}
